<div class="bg-light lter b-b wrapper-md">
    <h4 class="m-n font-thin">公告管理</h4>
</div>
<div class="wrapper-md ng-scope">
    <div ng-controller="noticeCtrl">
        <tabset class="tab-container m-n">
            <tab heading="平台公告" ng-click="query(0)">
                <div class="table-responsive fa-border">
                    <table class="table table-striped m-n">
                        <thead>
                        <tr>
                            <th width="50%">内容</th>
                            <th>标题</th>
                            <th>类型</th>
                            <th>发布人</th>
                            <th>截止时间</th>
                            <th width="200" class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="n in list">
                            <td>{{n.content|textLengthSet:true:100:'...'}}</td>
                            <td>{{n.name}}</td>
                            <td>
                                <label class="text-success font-bold" ng-if='n.type==0'>系统公告</label>
                                <label class="text-info font-bold" ng-if='n.type==2'>城市运营公告</label>
                            </td>
                            <td>{{n.issuerName}}</td>
                            <td>{{n.endTime}}</td>
                            <td class="t-btns text-center" >
                                <a ui-sref="app.noticeDetail({id:n.id})" class="btn btn-sm btn-success" target="_blank">查看</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                        <span class="h6">~未搜索到任何数据~</span>
                    </div>
                    <div>
                        <circle-loading ng-if="app.loading"></circle-loading>
                    </div>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="col-sm-4 hidden-xs">
                        </div>
                        <div class="col-sm-4 text-center">
                            <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                        </div>
                        <div class="col-sm-4 text-right text-center-xs">
                            <pagination boundary-links="true" total-items="totalItems" ng-model="page.currentPage"
                                        ng-change="replacePage()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                        previous-text="上一页" next-text="下一页"
                                        first-text="首页" last-text="尾页"></pagination>
                        </div>
                    </div>
                </footer>
            </tab>
            <tab heading="店铺公告" ng-click="query(1)">
                <div class="m-b panel-body no-padder">
                    <div class="col-sm-3 pull-right">
                        <a href="" class="btn btn-sm btn-info pull-right" ui-sref="app.noticeAdd">新建公告</a>
                    </div>
                </div>
                <div class="table-responsive fa-border">
                    <table class="table table-striped m-n">
                        <thead>
                        <tr>
                            <th width="40%">内容</th>
                            <th>标题</th>
                            <th>发布人</th>
                            <th>发布账户</th>
                            <th>标签</th>
                            <th>截止时间</th>
                            <th>状态</th>
                            <th width="200" class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="n in list">
                            <td>{{n.content|textLengthSet:true:100:'...'}}</td>
                            <td>{{n.name}}</td>
                            <td>{{n.issuerName}}</td>
                            <td>{{n.mobilePhone}}</td>
                            <td>
                                <label class="font-bold text-success" ng-if='n.isShop==1'>商户</label>
                            </td>
                            <td>{{n.endTime}}</td>
                            <td>
                                <label class="label label-danger" ng-if='n.status==2'>已失效</label>
                                <label class="label label-default" ng-if='n.status==1'>未启用</label>
                                <label class="label label-success" ng-if='n.status==0'>已启用</label>
                            </td>
                            <td class="t-btns text-right" >
                                <a ui-sref="app.noticeDetail({id:n.id})" class="btn btn-sm btn-success" target="_blank">查看</a>
                                <button ng-if='n.status!=2' ui-sref="app.noticeEdit({id:n.id})" class="btn btn-sm btn-info">修改</button>
                                <button ng-if='n.status==2' ng-click="openDelete(n.id,n.name)" class="btn btn-sm btn-danger">删除</button>
                                <div class="btn-group dropdown" dropdown=""  ng-if='n.status!=2'>
                                    <button class="btn btn-sm btn-default" dropdown-toggle="" aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu">
                                        <li><a href="" ng-click="toTop(n.id)">置顶</a></li>
                                        <li class="divider"></li>
                                        <li ng-if='n.status==1'><a href="" ng-click="changeStatus(n.id)">启用</a></li>
                                        <li ng-if='n.status==0'><a href="" ng-click="changeStatus(n.id)">禁用</a></li>
                                        <li class="divider"></li>
                                        <li><a href="" ng-click="makeFailure(n.id)">失效</a></li>
                                        <li class="divider"></li>
                                        <li><a href="" ng-click="openDelete(n.id,n.name)">删除</a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                        <span class="h6">~未搜索到任何数据~</span>
                    </div>
                    <div>
                        <circle-loading ng-if="app.loading"></circle-loading>
                    </div>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="col-sm-4 hidden-xs">
                        </div>
                        <div class="col-sm-4 text-center">
                            <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                        </div>
                        <div class="col-sm-4 text-right text-center-xs">
                            <pagination boundary-links="true" total-items="totalItems" ng-model="page.currentPage"
                                        ng-change="replacePage()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                        previous-text="上一页" next-text="下一页"
                                        first-text="首页" last-text="尾页"></pagination>
                        </div>
                    </div>
                </footer>
            </tab>
        </tabset>
    </div>
</div>
